<!-- <template> <MatrixLayout parent-id="c2de194058444ffc9fdf83a39b661c84" /> </template> -->
<template><div></div></template>
<script>
  import { defineComponent, h, reactive } from 'vue';
  import MatrixLayout from './layout.vue';
  import { useMicroStore } from '@common/store/micro-store';
  import { renderVNode } from '@jecloud/ui';

  export default defineComponent({
    name: 'MatrixView',
    // components: { MatrixLayout },
    setup() {
      const microStore = useMicroStore();
      // 3. 子功能微模块
      // 注意：注册事件名必须与子功能项编码保持一致，否则无法触发事件
      microStore.on('JE_RBAC_MATRIX_CHILD_MATRRRIX', (container, { $child, model }) => {
        const state = reactive({ parentId: model.JE_RBAC_MATRIX_ID, refreshType: true });
        // 表单切换数据事件
        $child.on('model-change', ({ model }) => {
          state.parentId = model.JE_RBAC_MATRIX_ID;
          state.refreshType = !state.refreshType;
        });
        // 渲染组件，以Input为例，可以改为自己的业务组件
        renderVNode(container, () => h(MatrixLayout, state));
      });

      return {};
    },
  });
</script>

<style lang="less" scoped></style>
